import connection from "@/app/database";
import { addHandle, deleteHandle, listHandle, updateHandle } from "@/utils/sql";
import { get } from "http";
import { ResultSetHeader, RowDataPacket } from "mysql2";

class Role {
  async add(role_item: API.roleItem) {
    return await addHandle<API.roleItem>(role_item, "role");
  }
  async delete(ids: number[]) {
    return await deleteHandle(ids, "role");
  }
  async update(role_item: API.roleItem) {
    return await updateHandle<API.roleItem>(role_item, "role");
  }
  async getList(params: API.roleList): Promise<API.ResponseApi<API.roleItem>> {
    return listHandle<API.roleList, API.roleItem>(params, "role");
  }
}

export default new Role();
